/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cansniffer;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author PiotrGl
 */
class Maski {
    private List<Maska> maski = new ArrayList<Maska>();
 
    void Maski(){
        
    }
    
    void add(Maska ms){
        maski.add(ms);
    }
    
    String find(int maska){
        Iterator<Maska> it = maski.iterator();
        String ret = "";
        while (it.hasNext() && ret.equals("")){
            Maska ma = it.next();
            int m = ma.getMask();
            int v = ma.getValue();
            if (( v & m ) ==( maska & m )){
                ret = ma.getInfo();
            }   
        }
        return ret;
    }
    

    
}
